package ru.niir.goodfil.utils;

import java.util.ArrayList;
import java.util.List;

public class DebugHelper {
    public static List<String> getStackTrace() {
        StackTraceElement[] elements = new Throwable().getStackTrace();
        List<String> result = new ArrayList<String>();
        for (StackTraceElement element : elements) {
            String classname = element.getClassName();
            if (!classname.startsWith("ru.niir")) {
                continue;
            }

            String line = classname + "#" +
                    element.getMethodName() + " (" +
                    element.getFileName() + ": " +
                    element.getLineNumber() + ")";
            result.add(line);
        }
        return result;
    }
}
